<?php
namespace User\Controller;
use Common\Controller\BehaviorController;
use Common\Model\InfoContentModel;
use Common\Model\UserModel;

class CommonController extends BehaviorController {

    public function __construct(){
        parent::__construct();
        $IsLogin = $this->IsLogin();
        $this->loginUserInfo = $IsLogin;
    }

    public $loginUserInfo = array();

    public function getUserInfo(){

        if(isset($this->loginUserInfo[0])){
            $uid = $this->loginUserInfo[0];
            $userModel = new UserModel();
            $userData = $userModel->getUserById($uid);
            return $userData;
        }

        return array();
    }

    public function getInfoById($id){
        $infoModel = new InfoContentModel();
        $infoData = $infoModel->getInfoById($id);
        return $infoData;
    }
}